package markgame2dphys;

import java.awt.Color;

import net.phys2d.math.Vector2f;
import net.phys2d.raw.SlideJoint;

public class MarkGameSlideJoint extends MarkGameJoint{

	public SlideJoint joint;

	public MarkGameSlideJoint(MarkGameObject obj1, MarkGameObject obj2, Vector2f anchor1, Vector2f anchor2, float minDistance, float maxDistance, float restitution) {

		super(new SlideJoint(obj1.body, obj2.body, anchor1, anchor2, minDistance, maxDistance, restitution));
		//TODO adicionar restitution
		joint = (SlideJoint)super.joint;
	}

	public void paint(MarkGameGraphics g) {

		int radius = 2;

		g.setColor(Color.RED);

		Vector2f anchor1 = MarkGameUtils.convertLocalToGlobal(joint.getBody1(), (Vector2f)joint.getAnchor1());
		g.drawCircle(anchor1, radius);

		Vector2f anchor2 = MarkGameUtils.convertLocalToGlobal(joint.getBody2(), (Vector2f)joint.getAnchor2());
		g.drawCircle(anchor2, radius);

		g.drawLine(anchor1, anchor2);

	}


}
